#include "common.h"
#include <pthread.h>

typedef struct _thread
{
	int num;
	char *str_t;
}thread_t;

void *func(void *arg)
{
	static int exit_num = 100;

	thread_t *val = (thread_t *)arg;
	printf("in func print int: %d\n", val->num);
	printf("in func print char : %s\n", val->str_t);

	return &exit_num;
}

int main()
{
	pthread_t tid;
	int ret = 0;
	void *value = NULL;

	char str[] = "hello thread\n";
	thread_t arg_struct = {20, str};

	ret = pthread_create(&tid, NULL, func, (void*)&arg_struct);
	if(ret != 0)
		err_sys("pthread_create error\n");

	pthread_join(tid, &value);
	printf("thread exit code = %d\n", *((int *)value));

	return 0;

}
